return {
  {
    -- 此插件用于编辑snip文件，若直接使用vsnip进行补全，将在补全时报错
    "hrsh7th/vim-vsnip",
    config = function()
      -- 配置自定义补全片段路径
      vim.g.vsnip_snippet_dir = "~/.config/nvim/snippets"
      -- 配置快捷键
      vim.keymap.set("n", "se", ":VsnipOpenEdit<CR>", {})
    end,
  },
  {
    "saghen/blink.cmp",
    version = not vim.g.lazyvim_blink_main and "*",
    build = vim.g.lazyvim_blink_main and "cargo build --release",
    opts_extend = {
      "sources.completion.enabled_providers",
      "sources.compat",
      "sources.default",
    },
    dependencies = {
      "rafamadriz/friendly-snippets",
      --添加emoji
      "moyiz/blink-emoji.nvim",
      -- add blink.compat to dependencies
      {
        "saghen/blink.compat",
        optional = true, -- make optional so it's only enabled if any extras need it
        opts = {},
        version = not vim.g.lazyvim_blink_main and "*",
      },
    },

    ---@module 'blink.cmp'
    ---@type blink.cmp.Config
    opts = {
      snippets = {
        preset = "default",
      },

      completion = {
        -- 不预选第一个项目，选中后不自动插入该项目文本
        list = { selection = { preselect = false, auto_insert = false } },
        accept = {
          -- experimental auto-brackets support
          auto_brackets = {
            enabled = true,
          },
        },
        menu = {
          draw = {
            treesitter = { "lsp" },
          },
          -- 显示外框
          border = "single",
        },
        -- 选择补全项目时显示文档(0秒延迟)
        documentation = {
          auto_show = true,
          auto_show_delay_ms = 0,
          -- 显示外框
          window = { border = "single" },
        },

        ghost_text = { enabled = vim.g.ai_cmp },
      },

      -- 显示外框
      signature = { window = { border = "single" } },
      -- experimental signature help support
      -- signature = { enabled = true },

      sources = {
        -- adding any nvim-cmp sources here will enable them
        -- with blink.compat
        compat = {},
        default = {
          "lsp",
          "path",
          "snippets",
          "buffer",
          "emoji",
        },

        providers = {
          emoji = { -- 使用':单词'激活
            name = "Emoji",
            module = "blink-emoji",
            score_offset = 1, -- Tune by preference
            opts = { insert = true }, -- Insert emoji (default) or complete its name
          },
          snippets = {
            score_offset = 8, -- Tune by preference
            opts = {
              friendly_snippets = true, -- default
            },
          },
          buffer = { score_offset = 2 },
          path = { score_offset = 10 },
          lsp = { score_offset = 6 },

          cmdline = {
            -- 小于1个字符不显示补全(配置)
            min_keyword_length = function(ctx)
              -- when typing a command, only show when the keyword is 3 characters or longer
              if ctx.mode == "cmdline" and string.find(ctx.line, " ") == nil then
                return 1
              end
              return 0
            end,
          },
        },
        -- score_offset设置优先级数字越大优先级越高
      },

      cmdline = {
        enabled = true,
        keymap = {
          preset = "cmdline",
          -- ["<Right>"] = false,
          -- ["<Left>"] = false,
          -- keymap = {
          -- 选择并接受预选择的第一个
          ["<CR>"] = { "accept", "fallback" },
          -- },
        },
        completion = {

          -- 不预选第一个项目，选中后自动插入该项目文本
          list = { selection = { preselect = false, auto_insert = false } },
          menu = {
            auto_show = function(ctx)
              return vim.fn.getcmdtype() == ":"
            end,
          },
          ghost_text = { enabled = true },
        },
      },

      -- 在选择时，不会自动不全第一个非选择选项
      keymap = {
        preset = "none",
        ["<C-y>"] = { "select_and_accept" },

        -- fallback命令将运行下一个非闪烁键盘映射(回车键的默认换行等操作需要)
        ["<CR>"] = { "accept", "fallback" }, -- 更改成'select_and_accept'会选择第一项插入

        ["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
        ["<Tab>"] = { "select_next", "snippet_forward", "fallback" },

        ["<C-u>"] = { "scroll_documentation_up", "fallback" },
        ["<C-d>"] = { "scroll_documentation_down", "fallback" },
      },

      appearance = {
        -- sets the fallback highlight groups to nvim-cmp's highlight groups
        -- useful for when your theme doesn't support blink.cmp
        -- will be removed in a future release, assuming themes add support
        use_nvim_cmp_as_default = false,
        -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
        -- adjusts spacing to ensure icons are aligned
        nerd_font_variant = "mono",
      },
    },
  },
}
